Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added api discovery to kubectl run, based on which we decide which generators to use #22849

Merged
merged 1 commit into from
Mar 11, 2016

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Mar 11, 2016

Fixes #22836.

@bgrant0607 @jlowdermilk @lavalamp @deads2k @soltysh @janetkuo wdyt?

PS If fixes/changes are needed after 4pm UTC take over this PR and resubmit since I'll be out the entire evening.

@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 11, 2016
@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test failed for commit 3077c5d6cc6de9722733bf05818785b076430876.

Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake.

@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test passed for commit daf955834f265373ac7d706888808dbc7f5402f3.

if restartPolicy == api.RestartPolicyAlways {
generatorName = "deployment/v1beta1"
if contains(groupList, "extensions/v1beta1") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constants for group/versions and use GroupVersion objects.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're going to need some comments explaining priority decisions here. I know it, but I think its because I just read the issue and a month from now someone is going to be looking through. and wondering.

@deads2k
Copy link
Contributor

deads2k commented Mar 11, 2016

If we have a decent mock for the discovery client I'd like to see a unit test or two, but this looks fine.

groupList, err := client.Discovery().ServerGroups()
if err != nil {
// this cover the cases where old servers do not expose discovery
groupList = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what makes it work against 1.1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my idea, I don't have any 1.1 cluster at hand :( Although I can compile 1.1 version and see what I'm gonna get.

@bgrant0607 bgrant0607 added this to the v1.2 milestone Mar 11, 2016
@bgrant0607 bgrant0607 added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. cherrypick-candidate labels Mar 11, 2016
@bgrant0607
Copy link
Member

Thanks for jumping on this so quickly!

Could you please update the description text for --generator?

@soltysh
Copy link
Contributor Author

soltysh commented Mar 11, 2016

@deads2k @bgrant0607 I've addressed all the comments. Tested that against 1.1 cluster. It nicely falls back all the way back to running pods if jobs are disabled in 1.1 (the default behavior). ptal

@bgrant0607
Copy link
Member

Thanks, @soltysh.

Please run hack/update-all.sh.

@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test failed for commit aefb94e2224dfa9a92b58241adc3514b86cf8ed4.

Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake.

@soltysh
Copy link
Contributor Author

soltysh commented Mar 11, 2016

@bgrant0607 done, sorry

@bgrant0607
Copy link
Member

LGTM, assuming tests pass. Thanks much

@bgrant0607 bgrant0607 added lgtm "Looks good to me", indicates that a PR is ready to be merged. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. labels Mar 11, 2016
@@ -254,6 +276,22 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob
return nil
}

func contains(resourcesList map[string]*unversioned.APIResourceList, gv unversioned.GroupVersion, name string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GroupVersionResource?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how about a TODO to make this more library-esq. It looks like it would have general utility as a layer on top of a discovery client.

@bgrant0607 bgrant0607 removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2016
@bgrant0607
Copy link
Member

Thanks for the comments @deads2k. Removed lgtm. Please reapply when your comments are addressed.

@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test failed for commit d5659eb8a4ae6cdc5730d0c26f4815f5ee02b5ea.

Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake.

@soltysh
Copy link
Contributor Author

soltysh commented Mar 11, 2016

On it...

@soltysh
Copy link
Contributor Author

soltysh commented Mar 11, 2016

@deads2k @bgrant0607 comments addressed ptal.

@soltysh
Copy link
Contributor Author

soltysh commented Mar 11, 2016

If more tweaks are needed or tests fail please pick up this PR because I'll be leaving and won't be able to touch it and I do realize this is important to have in as soon as possible.

@bgrant0607
Copy link
Member

Thanks @soltysh

@bgrant0607
Copy link
Member

There are no unit test results, so I can't see what failed.

@k8s-bot unit test this issue: #IGNORE

@deads2k deads2k added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2016
@deads2k
Copy link
Contributor

deads2k commented Mar 11, 2016

lgtm

@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test passed for commit f27871e.

@bgrant0607
Copy link
Member

All green. Merging @k8s-oncall

bgrant0607 added a commit that referenced this pull request Mar 11, 2016
Added api discovery to kubectl run, based on which we decide which generators to use
@bgrant0607 bgrant0607 merged commit 1c50f18 into kubernetes:master Mar 11, 2016
eparis pushed a commit to eparis/kubernetes that referenced this pull request Mar 11, 2016
Added api discovery to kubectl run, based on which we decide which generators to use
@eparis
Copy link
Contributor

eparis commented Mar 11, 2016

This PR was sucessfully cherry picked in PR #22855
please verify that the release-1.2 branch contains these changes as you would expect and contact @eparis if there appear to be problems.

@eparis eparis removed cherrypick-candidate cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. labels Mar 11, 2016
@soltysh soltysh deleted the issue22836 branch March 13, 2016 21:28
metahertz pushed a commit to metahertz/kubernetes that referenced this pull request Apr 4, 2016
Added api discovery to kubectl run, based on which we decide which generators to use
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
Added api discovery to kubectl run, based on which we decide which generators to use
shouhong pushed a commit to shouhong/kubernetes that referenced this pull request Feb 14, 2017
Added api discovery to kubectl run, based on which we decide which generators to use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

default kubectl run with kubectl 1.2 is not backwards compatible with 1.1 master
8 participants